Guided Practice 7.2

Consider the computation of

(program-all-defined?
    (list
     (make-def 'f1 (list 'x) (make-appexp 'f2 (list (make-varexp 'x))))
     (make-def 'f2 (list 'x 'y) (make-appexp 'f2
                                             (list (make-varexp 'z)
                                                   (make-varexp 'y))))
     (make-def 'f3 (list 'x 'y 'z)
               (make-appexp 'f1 (list (make-appexp 'f2
                                                   (list (make-varexp 'z)
                                                         (make-varexp 'y)))
                                   (make-varexp 'x))))))

Which of the following will appear as calls during this computation? Which of the following satisfy the invariant?

  1. (exp-all-defined? (make-varexp 'z) (list 'f1 'x))
  2. (exp-all-defined? (make-varexp 'z) (list 'f3 'x 'y 'z 'f2 'f1))
  3. (exp-all-defined? (make-varexp 'z) (list 'f2 'x 'y 'z 'f1))
  4. (exp-all-defined? (make-varexp 'z) (list 'f3 'x 'y 'f1 'z))

[ANSWER]


Last modified: Mon Oct 17 16:39:07 Eastern Daylight Time 2016